//
//  Model_notificationSystem.m
//  KWNLaywerClient
//
//  Created by 孔六五 on 15/1/29.
//  Copyright (c) 2015年 张明磊. All rights reserved.
//

#import "Model_notificationSystem.h"

@implementation Model_notificationSystem

- (void)getSystemDataWithDic:(NSDictionary *)dic;
{
    NSString *automatic = [dic objectForKey:@"automatic"];
    NSString *id_ = [dic objectForKey:@"id"];
    NSString *content = [dic objectForKey:@"content"];
    NSString *contentimg = [dic objectForKey:@"contentimg"];
    
    NSString *isunread = [dic objectForKey:@"isunread"];
    NSString *link = [dic objectForKey:@"link"];
    NSString *time = [dic objectForKey:@"time"];
    NSString *title = [dic objectForKey:@"title"];

    if(automatic && ![automatic isKindOfClass:[NSNull class]]){
        self.string_automatic = automatic;
    }
    if(id_ && ![id_ isKindOfClass:[NSNull class]]){
        self.string_id = id_;
    }
    if(content && ![content isKindOfClass:[NSNull class]]){
        self.string_content = content;
    }
    if(contentimg && ![contentimg isKindOfClass:[NSNull class]]){
        if (contentimg.length > 0) {
            self.string_contentimg = contentimg;
        }
    }
    if(isunread && ![isunread isKindOfClass:[NSNull class]]){
        self.string_isunread = isunread;
    }
    if(link && ![link isKindOfClass:[NSNull class]]){
        self.string_link = link;
    }
    if(time && ![time isKindOfClass:[NSNull class]]){
        self.string_time = time;
    }
    if(title && ![title isKindOfClass:[NSNull class]]){
        self.string_title = title;
    }
    
    CGFloat height = 0;
    height = 15;
    CGFloat titleHeight = [UIUtils heightFor:self.string_title withFont:FontOfQuestionList labWidth:MainScreenWidth - 15*2];
    height = titleHeight + height + 15;
    if (self.string_contentimg && self.string_contentimg.length > 0) {
        
        //图片大小290*74
        CGFloat scale = (MainScreenWidth - 15 * 2)/290.0;
        height = height + 74*scale + 15;
    }
    
    if (self.string_content && self.string_content.length > 0) {
        CGFloat contentHeight = [UIUtils heightFor:self.string_content withFont:FontOfHelveticaBold(14) labWidth:MainScreenWidth - 15*2];
        height = height + contentHeight + 15;
    }
    
    height = height + 15 + 15;
    self.nSHeight = height;
}

@end
